// Package router
// @Author: zhangdi
// @File: router_sys_user
// @Version: 1.0.0
// @Date: 2023/10/16 15:52
package router

import (
	"server/application/constant/apis"
	"server/application/constant/enums"
	"server/application/controller/sysctrl"
	"server/application/db/system/dbdto"
	"server/application/dto"
	"server/pkg/ginp"
)

func init() {

	//创建
	AppendRouter(ItemInfo{ //create
		Path:           apis.ApiSysUserCreate,                   //qpi路径
		Handlers:       ginp.ConvHandler(sysctrl.SysUserCreate), //对应控制器
		HttpType:       HttpPost,                                //http请求类型
		NeedLogin:      true,                                    //是否需要登录
		NeedPermission: true,                                    //是否需要鉴权
		PermissionName: "SysUser.create",                        //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:       "创建用户",
			RequestDto:  dbdto.SysUserCreate{},
			Description: "",
			Consumes:    nil,
		},
	})

	//修改
	AppendRouter(ItemInfo{ //update
		Path:           apis.ApiSysUserUpdate,                   //qpi路径
		Handlers:       ginp.ConvHandler(sysctrl.SysUserUpdate), //对应控制器
		HttpType:       HttpPost,                                //http请求类型
		NeedLogin:      true,                                    //是否需要登录
		NeedPermission: true,                                    //是否需要鉴权
		PermissionName: "SysUser.update",                        //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "修改 SysUser",
			RequestDto: dbdto.SysUserUpdate{},
		},
	})

	// 删除
	AppendRouter(ItemInfo{ //delete
		Path:           apis.ApiSysUserDelete,                   //qpi路径
		Handlers:       ginp.ConvHandler(sysctrl.SysUserDelete), //对应控制器
		HttpType:       HttpPost,                                //http请求类型
		NeedLogin:      true,                                    //是否需要登录
		NeedPermission: true,                                    //是否需要鉴权
		PermissionName: "SysUser.delete",                        //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "删除 SysUser",
			RequestDto: dbdto.SysUserDelete{},
		},
	})

	//search 搜索
	AppendRouter(ItemInfo{ //search
		Path:           apis.ApiSysUserSearch,                   //qpi路径
		Handlers:       ginp.ConvHandler(sysctrl.SysUserSearch), //对应控制器
		HttpType:       HttpPost,                                //http请求类型
		NeedLogin:      true,                                    //是否需要登录
		NeedPermission: true,                                    //是否需要鉴权
		PermissionName: "SysUser.search",                        //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "搜索 SysUser",
			RequestDto: dto.ReqSearch{},
		},
	})

	//登录
	AppendRouter(ItemInfo{ //search
		Path:           apis.ApiUserLogin,               //qpi路径
		Handlers:       ginp.ConvHandler(sysctrl.Login), //对应控制器
		HttpType:       HttpPost,                        //http请求类型
		NeedLogin:      false,                           //是否需要登录
		NeedPermission: false,                           //是否需要鉴权
		PermissionName: "",                              //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "登录",
			RequestDto: dto.ReqSysLogin{},
		},
	})

	//登录状态
	AppendRouter(ItemInfo{ //search
		Path:           apis.ApiUserIsLogin,               //qpi路径
		Handlers:       ginp.ConvHandler(sysctrl.IsLogin), //对应控制器
		HttpType:       HttpPost,                          //http请求类型
		NeedLogin:      false,                             //是否需要登录
		NeedPermission: false,                             //是否需要鉴权
		PermissionName: "",                                //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "判断是否登录",
			RequestDto: dto.ReqSysIsLogin{},
		},
	})

	AppendRouter(ItemInfo{ //create
		Path:           apis.ApiSysUserUpdatePwd,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.SysUserUpdatePwd), //对应控制器
		HttpType:       HttpPost,                                   //http请求类型
		NeedLogin:      true,                                       //是否需要登录
		NeedPermission: false,                                      //是否需要鉴权
		PermissionName: "",                                         //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "修改密码",
			RequestDto: dto.DtoSysUserUpdatePwd{},
		},
	})

	AppendRouter(ItemInfo{ //导入excel数据
		Path:           apis.ApiSysUserImport,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.SysUserImport), //对应控制器
		HttpType:       HttpPost,                                //http请求类型
		NeedLogin:      true,                                    //是否需要登录
		NeedPermission: true,                                    //是否需要鉴权
		PermissionName: "SysUser." + enums.BtnAuthImport,        //完整的权限名称,会跟权限表匹配
	})

	AppendRouter(ItemInfo{ //获取导入模板文件
		Path:           apis.ApiSysUserImportTemplateFile,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.SysUserImportTemplateFile), //对应控制器
		HttpType:       HttpPost,                                            //http请求类型
		NeedLogin:      true,                                                //是否需要登录
		NeedPermission: false,                                               //是否需要鉴权
		PermissionName: "SysUser." + enums.BtnAuthCreate,                    //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title: "数据导入",
		},
	})

	AppendRouter(ItemInfo{ //数据导出
		Path:           apis.ApiSysUserExport,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.SysUserExport), //对应控制器
		HttpType:       HttpPost,                                //http请求类型
		NeedLogin:      true,                                    //是否需要登录
		NeedPermission: false,                                   //是否需要鉴权
		PermissionName: "",                                      //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "数据导出",
			RequestDto: dto.ReqSearch{},
		},
	})
	//{{append}}
}
